Main ----- Copyright Up Previous Next

Macros

Macros can be defined like
<$MACRO MacroName [ flags ] [ attributes ] >

...macro text...

</$MACRO>
Here are some examples of macro definitions:

Use as a shortcut

You can define a macro called MyAddress that only is a shortcut for your email-address like
<$MACRO MyAddress>
hugo@some.where
</$MACRO>
So every time, you insert the macro-tag <MyAddress> in your hsc-source, it will be replaced by
hugo@some.where
in the HTML-object.

Create your own logical style

One of the most embarassing facts within HTML are physical/logical styles. Taking a look at the HTML 3.0 proposed things, you find loads of new styles: <AU> for authors, <SAMP> for sequences of litteral characters and so on... No one knows where this will end, and I'm just waiting for logical styles like <TIM_BERNERS_LEE_S_LOGICAL_STYLE_TO_RENDER_THE_NAME_OF_HIS_DOG>. (Which would asume that TBL has a dog)

Anyway, while other people think about which logical style should get his own tag and which not, you can define your own styles. For example, a logical style to render a filename could look like this:
<$MACRO FILE><I></$MACRO>      <* enable italic *>
<$MACRO /FILE></I></$MACRO>    <* disable italic *>

Your new style can be used like all other styles:
  ..open the file <FILE>hugo.txt</FILE> and..
In this case, filenames will be rendered italic:
..open the file hugo.txt and..

This seems much more reasonable to me then producing heaps of logical styles, but..

Note that you just created a container that requires an start- and end-tag.

Macros with custom attributes

Take a look at this example:
<$MACRO BUTTON_NEXT NxtRef:uri>
<A HREF=(NxtRef)><IMG SRC=":image/next.gif" ALT="Next"></A>
</$MACRO>
This defines a macro that defines a button that references to the next page. As every page has its own next page, you can set one attribute for this macro: NXTREF, which is the URI that should be referenced as the "next" page.

So an example usage of this macro would be:

  <BUTTON_NEXT NXTREF=":features/rplcent.html">
which will give the button seen below:

Next

Note that the value of NXTREF is passed to the HREF attribute within the <A> tag when the macro is extracted.

If you wonder, what HREF=(NxtRef) (see above) should mean: This sets HREF with the value stored in NxtRef. For details, read the section about expressions.

Some Notes

Names for macros and attributes are case-insensitive.

Macro attributes can only be defined within opening macros. The coresponding closing macro automatically inherits all attributes of its opening macro. This seems more HTML-like to me.

SGML is able to handle macros.

To make your macros more powerful and flexible, you can use expressions and conditional conversion.


Thomas Aglassinger ( agi@giga.or.at ), 15-May-1996